home *** CD-ROM | disk | FTP | other *** search
- ; function to select banks on popular video cards
- ;
- ; void SetBank(int device,int bank)
- ;
-
- Device EQU dword ptr [ebp+8]
- Bank EQU word ptr [ebp+12]
- TSENG EQU 0
- VIDEO7 EQU 1
- PARADISE EQU 2
-
- ASSUME ds:dseg,cs:cseg
-
- dseg SEGMENT
- curbk DB 0
- dseg ends
-
- cseg SEGMENT dword public 'CODE'
- public setbank
- db 'setbank',7
- setbank proc near ;64k bank number is in AX
- push ebp
- mov ebp,esp
- push esi
- push edi
-
- mov ax,Bank
- push ax
- push dx
- cli
- mov curbk,al
- cmp Device,TSENG
- jnz nots
- and al,7 ;Tseng
- mov ah,al
- shl ah,1
- shl ah,1
- shl ah,1
- or al,ah
- or al,01000000b
- mov dx,3cdh
- out dx,al
- sti
- pop dx
- pop ax
- pop edi
- pop esi
- mov esp,ebp
- pop ebp
- ret
-
- nots: cmp Device,VIDEO7
- jnz nov7
- and ax,15 ;Video 7
- push cx
- mov ch,al
- mov dx,3c4h
- mov ax,0ea06h
- out dx,ax
- mov ah,ch
- and ah,1
- mov al,0f9h
- out dx,ax
- mov al,ch
- and al,1100b
- mov ah,al
- shr ah,1
- shr ah,1
- or ah,al
- mov al,0f6h
- out dx,al
- inc dx
- in al,dx
- dec dx
- and al,not 1111b
- or ah,al
- mov al,0f6h
- out dx,ax
- mov ah,ch
- mov cl,4
- shl ah,cl
- and ah,100000b
- mov dl,0cch
- in al,dx
- mov dl,0c2h
- and al,not 100000b
- or al,ah
- out dx,al
- sti
- pop cx
- pop dx
- pop ax
- pop edi
- pop esi
- mov esp,ebp
- pop ebp
- ret
-
- nov7: cmp Device,PARADISE
- jnz nopd
- mov dx,3ceh ;Paradise
- mov ax,50fh ;turn off write protect on VGA registers
- out dx,ax
- mov ah,curbk
- shl ah,1
- shl ah,1
- shl ah,1
- shl ah,1
- mov al,9
- out dx,ax
-
- nopd: sti
- pop dx
- pop ax
- pop edi
- pop esi
- mov esp,ebp
- pop ebp
- ret
- setbank endp
- cseg ends
- end
-